//*************************************************************************
// File Name: TransactionList.cpp
// This is the implementation file for the member functions
// of Class TransactionList
// "Group 3"
// CS 1C
// March 25, 2010
// Group Project: SuperWarehouse
// Due: March 25, 2010
// - KZ's comment
//*************************************************************************

#include "TransactionList.h"

//  private class members
//	list

TransactionList::TransactionList() {
	// TODO Auto-generated constructor stub

}

TransactionList::~TransactionList() {
	// TODO Auto-generated destructor stub
}

/*
 * 	void addTransaction(Transaction t);
	void removeTransaction(Transaction t);
	TransactionList findTransactions();
	int getNumTransactions() const;
	Transaction retrieveTransactionAtIndex(int idx);
 *
 */
void TransactionList::addTransaction(Transaction *t) {
	list.push(t);
}

void TransactionList::removeTransaction(Transaction *t) {
	int idx;
	idx = list.findIndexOfElement(t);
	if (idx >= 0) {
		list.removeElementAtIndex(idx);
	}
}

TransactionList *TransactionList::findTransactions() {
	TransactionList *ret = new TransactionList();
	return ret;
}

Transaction *TransactionList::retrieveTransactionAtIndex(int idx) {
	return list.retrieveElementAtIndex(idx);
}

int TransactionList::getNumTransactions() const {
	return list.getNumElements();
}

TransactionList &TransactionList::operator=(const TransactionList &rhs) {
	if (this != &rhs) {
		this->list = rhs.list;
	}
	return *this;
}
